package com.zpark.jsoup;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.File;
import java.io.IOException;

/**
 * @PackageName: com.zpark.jsoup
 * @ClassName: Demo09
 * @Description:
 * @author: RZS
 * @date: 2021/8/15  23:55
 */
public class Demo09 {
    public static void main(String[] args) throws IOException {
        Document document = Jsoup.parse(new File("D:/HBuilderProjects/JavaScript/html/DOM/JSform.html"), "utf-8");
        Element formElement = document.getElementById("loginform");
        Elements elements = formElement.getElementsByTag("input");
        for (Element element : elements) {
            String key = element.attr("name");
            String value = element.attr("value");
            System.out.println("name属性"+key+" ，输入的值: "+value);
        }
    }
}
